﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace Ue.CQRS.Samples.Infrastructure.Data
{
    public interface IRepository<TKey, TValue>
    {
        TValue this[TKey key] { get; set; }

        ICollection<TKey> Keys { get; }

        ICollection<TValue> Values { get; }

        TValue GetOrAdd(TKey key, Func<TKey, TValue> addEntityFactory);

        TValue AddOrUpdate(TKey key, Func<TKey, TValue> addEntityFactory, Func<TKey, TValue, TValue> updateEntityFactory);

        TValue Remove(TKey key);

        bool ContainsKey(TKey key);

        IEnumerable<TValue> FindBy(Expression<Func<TValue, bool>> predicate, int? skip, int? count);
    }
}